/*
 * Package: org.grassfield.common.entity
 * FileName: MenuItem.java
 *  
 * Created by pandian on Jan 28, 2011
 */
package bean;

/**
 * The Class MenuItem.
 */
public class MenuItem implements Comparable<MenuItem> {
	private Long id;
	private String menuTitle;
	private Long parentId;
	private String locationHref;
	private Module module;

	/**
	 * Gets the id.
	 * 
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * Sets the id.
	 * 
	 * @param id
	 *            the new id
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * Gets the menu title.
	 * 
	 * @return the menu title
	 */
	public String getMenuTitle() {
		return menuTitle;
	}

	/**
	 * Sets the menu title.
	 * 
	 * @param menuTitle
	 *            the new menu title
	 */
	public void setMenuTitle(String menuTitle) {
		this.menuTitle = menuTitle;
	}

	/**
	 * Gets the parent id.
	 * 
	 * @return the parent id
	 */
	public Long getParentId() {
		return parentId;
	}

	/**
	 * Sets the parent id.
	 * 
	 * @param parentId
	 *            the new parent id
	 */
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	/**
	 * Gets the location href.
	 * 
	 * @return the location href
	 */
	public String getLocationHref() {
		return locationHref;
	}

	/**
	 * Sets the location href.
	 * 
	 * @param locationHref
	 *            the new location href
	 */
	public void setLocationHref(String locationHref) {
		this.locationHref = locationHref;
	}

	/**
	 * Gets the module.
	 * 
	 * @return the module
	 */
	public Module getModule() {
		return module;
	}

	/**
	 * Sets the module.
	 * 
	 * @param module
	 *            the new module
	 */
	public void setModule(Module module) {
		this.module = module;
	}

	@Override
	public int compareTo(MenuItem o) {
		return this.id.compareTo(o.getId());
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((menuTitle == null) ? 0 : menuTitle.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MenuItem other = (MenuItem) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (menuTitle == null) {
			if (other.menuTitle != null)
				return false;
		} else if (!menuTitle.equals(other.menuTitle))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "MenuItem [id=" + id + ", menuTitle=" + menuTitle + "]";
	}
}
